﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QD.Tools
{
    public static class PromptHelper
    {
        public static void Prompt(string mes)
        {
            MessageBox.Show(mes, "提示");
        }

        public static void Prompt(Exception ex)
        {
            Exception e = GetLastException(ex);
            Prompt(e.Message);
        }

        public static DialogResult PromptOkCancel(string mes)
        {
            DialogResult result = MessageBox.Show(mes, "提示", MessageBoxButtons.OKCancel);
            return result;
        }

        public static Exception GetLastException(Exception ex)
        {
            Exception e = null;
            if (ex.InnerException == null)
            {
                e = ex;
            }
            else
            {
                e = GetLastException(ex.InnerException);
            }
            return e;
        }
    }
}
